home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / haeberli / impression / ssshow.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  115 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  *    ssshow - 
  19.  *        Display a sample set on the screen.
  20.  *
  21.  *            Paul Haeberli - 1988
  22.  *
  23.  */
  24. #include "stdio.h"
  25. #include "gl.h"
  26. #include "device.h"
  27. #include "ss.h"
  28. #include "math.h"
  29. #include "image.h"
  30.  
  31. #define NSTYLES        13
  32.  
  33. int styles[NSTYLES] = {
  34.     CIRCLES,
  35.     MULTILINE,
  36.     SQUARES,
  37.     STROKES,
  38.     LONGSTROKES,
  39.     LINES,
  40.     SCATTER,
  41.     LONGSCATTER,
  42.     SCATTERPOLY,
  43.     CONE,
  44.     FINELINES,
  45.     ONELINE,
  46.     NEEDLEPOINT,
  47. };
  48.  
  49. long xsize, ysize;
  50. float addrot;
  51. sampleset *ss;
  52.  
  53. main(argc,argv)
  54. int argc;
  55. char **argv;
  56. {
  57.     int i, j;
  58.     short val;
  59.  
  60.     if( argc<2 ) {
  61.     fprintf(stderr,"usage: ssshow infile [-m]\n");
  62.     exit(1);
  63.     } 
  64.     winopen("ssshow");
  65.     pseudorgb();
  66.     subpixel(1);
  67.     ss = ssfromfile(argv[1]);
  68.     qmouse();
  69.     makeframe();
  70.     savergbwindow("blat.rgb");
  71.     j = 0;
  72.     while(1) {
  73.     switch(qread(&val)) {
  74.         case LEFTMOUSE:
  75.         if(val) {
  76.             j++;
  77.             if(j>=NSTYLES)
  78.             j = 0;
  79.             ssset(ss,styles[j]);
  80.             makeframe();
  81.         }
  82.         break;
  83.         case REDRAW:
  84.         makeframe();
  85.         break;
  86.     }
  87.     }
  88. }
  89.  
  90. makeframe()
  91. {
  92.     getsize(&xsize,&ysize);
  93.     reshapeviewport();
  94.     grey(0.5);
  95.     clear();
  96.     zbuffer(1);
  97.     zclear();
  98.     ssortho(xsize,ysize);
  99.     ssdraw(ss);
  100. }
  101.  
  102.  
  103. ssset(iss,val)
  104. sampleset *iss; 
  105. int val;
  106. {
  107.     sample *s;
  108.  
  109.     s = iss->head;
  110.     while(s) {
  111.     s->SAMPLE_SHAPE = val;
  112.     s = s->next;
  113.     }
  114. }
  115.